package controller

import "github.com/gin-gonic/gin"

type user struct {
	Method_     []string          // 支持的方法
	Middleware_ []gin.HandlerFunc // 中间件
}

var User *user

func init() {
	User = &user{
		Method_:     []string{"GET", "POST"},
		Middleware_: []gin.HandlerFunc{},
	}
}

func (u user) GetUser(c *gin.Context) {
	switch c.Request.Method {
	case "GET":
		// GET 处理逻辑
		c.String(200, "你是一个GET请求 GetUser")
	case "POST":
		// POST 处理逻辑
		c.String(200, "你是一个POST请求 GetUser")
	default:
		c.AbortWithStatus(405) // Method Not Allowed
	}
}
